package com.acsior.hibernate.vo;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import com.acsior.dac.impl.hibernate.vo.GeneratorKey;
import com.acsior.dac.impl.hibernate.vo.HibernatePersistantIntegerIdVO;

/**
 * CustomerContract entity. @author MyEclipse Persistence Tools <b><i>powered by
 * Belev</i></b>
 */
@Entity
@Table(name = "customer_contracts")
@GeneratorKey(tableName = "customer_contracts")
public class CustomerContractVO extends HibernatePersistantIntegerIdVO {

	private static final long serialVersionUID = 2875930823336722161L;

	@Column(name = "active", nullable = false)
	private boolean active;

	@Column(name = "contract_date", nullable = false, length = 23)
	private Date contractDate;

	@Column(name = "date_contract_end")
	private Date contractEndDate;

	@Column(name = "contract_number", nullable = false, length = 50)
	private String contractNumber;

	@Column(name = "date_contract_start")
	private Date contractStartDate;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "nom_contract_types_id", nullable = false)
	private NomContractTypeVO contractType;

	@Column(name = "description")
	private String description;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "registered_customer_id", nullable = false)
	private RegisteredCustomerVO registeredCustomer;

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "customerContract")
	private List<ServicePriceVO> servicePrices;

	/** default constructor */
	public CustomerContractVO() {
		this.servicePrices = new ArrayList<ServicePriceVO>();
	}

	/** @return the contractDate */
	public Date getContractDate() {
		return this.contractDate;
	}

	/**
	 * @return the contractEndDate
	 */
	public Date getContractEndDate() {
		return this.contractEndDate;
	}

	/** @return the contractNumber */
	public String getContractNumber() {
		return this.contractNumber;
	}

	/**
	 * @return the contractStartDate
	 */
	public Date getContractStartDate() {
		return this.contractStartDate;
	}

	/**
	 * @return the contractType
	 */
	public NomContractTypeVO getContractType() {
		return this.contractType;
	}

	/** @return the description */
	public String getDescription() {
		return this.description;
	}

	/** @return the registeredCustomer */
	public RegisteredCustomerVO getRegisteredCustomer() {
		return this.registeredCustomer;
	}

	/** @return the servicePrices */
	public List<ServicePriceVO> getServicePrices() {
		return this.servicePrices;
	}

	/**
	 * @return the active
	 */
	public boolean isActive() {
		return this.active;
	}

	/**
	 * @param active
	 *            the active to set
	 */
	public void setActive(boolean active) {
		this.active = active;
	}

	/**
	 * @param contractDate
	 *            the contractDate to set
	 */
	public void setContractDate(Date contractDate) {
		this.contractDate = contractDate;
	}

	/**
	 * @param contractEndDate
	 *            the contractEndDate to set
	 */
	public void setContractEndDate(Date contractEndDate) {
		this.contractEndDate = contractEndDate;
	}

	/**
	 * @param contractNumber
	 *            the contractNumber to set
	 */
	public void setContractNumber(String contractNumber) {
		this.contractNumber = contractNumber;
	}

	/**
	 * @param contractStartDate
	 *            the contractStartDate to set
	 */
	public void setContractStartDate(Date contractStartDate) {
		this.contractStartDate = contractStartDate;
	}

	/**
	 * @param contractType
	 *            the contractType to set
	 */
	public void setContractType(NomContractTypeVO contractType) {
		this.contractType = contractType;
	}

	/**
	 * @param description
	 *            the description to set
	 */
	public void setDescription(String description) {
		this.description = description;
	}

	/**
	 * @param registeredCustomer
	 *            the registeredCustomer to set
	 */
	public void setRegisteredCustomer(RegisteredCustomerVO registeredCustomer) {
		this.registeredCustomer = registeredCustomer;
	}

	/**
	 * @param servicePrices
	 *            the servicePrices to set
	 */
	public void setServicePrices(List<ServicePriceVO> servicePrices) {
		this.servicePrices = servicePrices;
	}

}